package com.qf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.Movie;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 作者：Xx凯丶
 * 时间：2022/4/21 15:07
 */
@Mapper
public interface MovieInfoMapper extends BaseMapper<Movie> {
    @Select("SELECT type_name FROM type \n" +
            "WHERE type_id in (SELECT type_id\n" +
            "FROM movie m\n" +
            "LEFT JOIN movie_type mt ON m.movie_Id = mt.movie_Id\n" +
            "WHERE m.movie_Id=#{movieId})")
    public List<String> queryTypeByMovieId(Integer movieId);
    @Select("SELECT actor_name FROM actor \n" +
            "            WHERE actor_id in (SELECT actor_id\n" +
            "            FROM movie m\n" +
            "            LEFT JOIN movie_actor ma ON m.movie_Id = ma.movie_Id\n" +
            "            WHERE m.movie_Id=#{movieId})")
    public List<String> queryAcNameByMovieId(Integer movieId);
    @Select("SELECT c.cinema_id,m.movie_Id,m.movie_ch,m.image,m.movie_time \n" +
            "FROM cinema c LEFT JOIN cinema_movie cm ON c.cinema_id = cm.cinema_id\n" +
            "LEFT JOIN movie m ON cm.movie_Id = m.movie_Id\n" +
            "where c.cinema_id = #{cinemaId}")
    public List<Movie> queryMovieInfoByCinemaId(Integer cinemaId);
}
